import Vue from 'vue'
import VueRouter from 'vue-router'

Vue.use(VueRouter)

const routes = [{
        path: "/",
        redirect: '/login'
    },
    //登录页
    {
        path: '/login',
        name: 'login',
        component: () => import('../view/login/Login.vue')
    },
    //首页
    {
        path: '/home',
        name: 'home',
        meta: {
            title: '首页'
        },
        redirect: '/index',
        component: () => import('../view/home/Home.vue'),
        children: [
            //导航首页
            {
                path: '/index',
                name: 'index',
                meta: {
                    title: '首页'
                },

                component: () => import('../view/home/nav/index/Index.vue'),
            },
            //数据管理
            {
                path: '/datamanger',
                name: 'datamanger',
                meta: {
                    title: '数据管理'
                },

                component: () => import('../view/home/nav/data_manag/DataManger.vue'),
            },
            //信息管理
            {
                path: '/infomanger',
                name: 'infomanger',
                meta: {
                    title: '信息管理'
                },

                component: () => import('../view/home/nav/info_manag/InfoManger.vue'),
                children: [
                    //列表展示
                    {
                        path: '/infomanger/listmanger',
                        name: 'listmanger',
                        meta: {
                            title: '列表展示'
                        },
                        component: () => import('../view/home/nav/info_manag/list_manag/ListManger.vue'),
                    }
                ]
            },
            //用户管理
            {
                path: '/rolemanger',
                name: 'rolemanger',
                meta: {
                    title: '用户管理'
                },
                component: () => import('../view/home/nav/role_manag/RoleManger.vue'),
                children: [
                    //用户统计
                    {
                        path: '/rolemanger/useradd',
                        name: 'useradd',
                        meta: {
                            title: '用户统计'
                        },
                        component: () => import('../view/home/nav/role_manag/user_add/UserAdd.vue'),
                    },
                    //角色统计
                    {
                        path: '/rolemanger/roleadd',
                        name: 'roleadd',
                        meta: {
                            title: '角色统计'
                        },
                        component: () => import('../view/home/nav/role_manag/role_add/RoleAdd.vue'),
                    },
                ]
            },
        ]
    },

]

const router = new VueRouter({
    routes,
    mode: "history"
})

export default router